---
title: "Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(p8105.datasets)
library(plotly)
```
```{r}
data(ny_noaa)
ny_noaa_df =
ny_noaa %>%
janitor::clean_names() %>%
filter(id == "USW00014735") %>%
filter(prcp > 0) %>%
separate(date, into = c("year", "month", "day"), sep = "\\-") %>%
select(-month, -day) %>%
filter(year > 2004)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Precipitation from 2005 to 2010
```{r}
ny_noaa_df %>%
plot_ly(x = ~prcp, type = "histogram")
```
Column {data-width=350}
-----------------------------------------------------------------------
### Relationship between the highest temperature and lowest temperatur from 2005 to 2010
```{r}
ny_noaa_df %>%
plot_ly(y = ~tmax, x = ~tmin, color = ~year, type = "scatter", mode = "markers",alpha = 0.5)
```
### Distribution of precipitation from 2005 to 2010
```{r}
ny_noaa_df %>%
plot_ly(y = ~prcp, color = ~year, type = "box", colors = "viridis")
```